<HTML>
	<TITLE>Workflow.NET
		<%#actionname%>
		-<%#propertyname%></TITLE>
	<STYLE><%#stylesheet%>
	</STYLE>
	<BODY marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
		<form name="wf_theform" method="post">
			<TABLE width="100%" height="100%" bgcolor="<%#bgcolor%>" cellspacing="0" cellpadding="0" border="0">
				<TR>
					<TD valign="top">
						<TABLE width="100%" height="100%">
							<TR>
								<TD valign="top"><%#Message%></TD>
							</TR>
							<TR>
								<TD valign="top" height="100%">
									<IFRAME name="frame_preview" height="100%" src="<%#requeststring%>&amp;pagesection=previewframe&amp;_mode=<%#mode%>" width="100%" height="100%">
									</IFRAME>
								</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="black"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="white"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD align="left" height="50" >
						<%#adddetails%>
					</TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="black"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="white"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD align="right" height="30">
						<%#Buttons%>
						<input type="button" class="buttons" value="Close" ID="btnCancel" onclick="closeme()" NAME="btnCancel">
					</TD>
				</TR>
			</TABLE>
			<input type="hidden" name="_hidtempstore" id="_hidtempstore">
			<input type="hidden" name="_mode" ID="_mode">
			<input type="hidden" name="_pageinfo" id="_pageinfo">
		</form>
		<SCRIPT>

		var mandatory="<%#mandatoryvalue%>";
		function closeme()
		{
			/*var t;
			if(navigator.userAgent.indexOf("Netscape") >0 )
				document.all = document.getElementsByTagName("*");
			t = self.opener.document.all["_hidtempstore"];
			t.form.method = "POST";
			t.form.submit();*/
			window.close();
		}
	function modify(pageinfo)
	{
		var returnvalue=getselectedvalues();
		if (returnvalue.length>0)
		{
			document.wf_theform._mode.value='modify';
			document.wf_theform._pageinfo.value = pageinfo;
			document.wf_theform._hidtempstore.value=returnvalue;
			document.wf_theform.submit()
		}
		else
		{
			alert("Please check the boxes against the Custom Fields you wish to Modify.");
		}

	}
	function addnew(tempstore)
	{
		if (isNaN(document.wf_theform.txtaddinputs.value)|| parseInt(document.wf_theform.txtaddinputs.value)==0)
		{
			alert("Incorrect entry. No. of additional Custom Fields should be a numeric value and greater than 0");
			document.wf_theform.txtaddinputs.focus();
			return ;
		}
		document.wf_theform._mode.value='addnew';
		document.wf_theform._pageinfo.value = 'page1';
		document.wf_theform._hidtempstore.value=tempstore;
		document.wf_theform.submit()
	}
	function setfields()
	{
		var returnvalue=getselectedvalues();
		if (returnvalue.length>0)
			{
				document.wf_theform._mode.value='setfields';
				document.wf_theform._pageinfo.value = 'page1';
				document.wf_theform._hidtempstore.value=returnvalue;
				document.wf_theform.submit()
			}
			else
			{
				alert("Please check the boxes against the Custom Fields you wish to Set.");
			}
	}
	function remove()
	{
		var returnvalue=getselectedvalues();
		if(mandatory == "True" && (getSelectedCount() == getTotalCount()) && getSelectedCount() != 0)
		{
			alert("Could not delete. Atleast one Custom Field needs to be defined.");
			return;
		}
		if (returnvalue.length>0)
		{
			var where_to= confirm("Do you really want to remove these fields ??. Deleting custom field will result in clearing values added for action executed already.");
			if (where_to== true)
			 {
				document.wf_theform._mode.value='remove';
				document.wf_theform._hidtempstore.value=returnvalue;
				document.wf_theform.submit()
			}
		}
		else
		{
			alert("Please check the boxes against the Custom Fields you wish to Delete.");
		}
	}
	function getTotalCount()
			{
				var returnvalue="";
				var i=0;
				var obj = eval("frame_preview");
				var tempobj;
				var d = obj.document
				return parseInt(d.wf_theform.fieldcount.value)
			}
	function getSelectedCount()
		{
			var selectedCount=0;
			var i=0;
			var obj = eval("frame_preview");
			var tempobj;
			var d = obj.document
			if (parseInt(d.wf_theform.fieldcount.value)> 0 )
					{
						tempobj = eval("d.wf_theform.wf_selection")
						for ( i = 0 ;i<parseInt(d.wf_theform.fieldcount.value);i++)
						{
							if (parseInt(d.wf_theform.fieldcount.value) ==1)
							{
								if (tempobj.checked)
									selectedCount++;
							}
							else if (tempobj[i].checked)
							{
								selectedCount++;
							}
						}
					}

					return selectedCount;

		}
	function getselectedvalues()
	{
		var returnvalue="";
		var i=0;
		var obj = eval("frame_preview");
		var tempobj;
		var d = obj.document
		if (parseInt(d.wf_theform.fieldcount.value)> 0 )
		{
			tempobj = eval("d.wf_theform.wf_selection")
			for ( i = 0 ;i<parseInt(d.wf_theform.fieldcount.value);i++)
			{
				if (parseInt(d.wf_theform.fieldcount.value) ==1)
				{
					if (tempobj.checked)
						returnvalue += "#" + tempobj.value;
				}
				else if (tempobj[i].checked)
				{
					returnvalue += "#" + tempobj[i].value
				}
			}
		}
		if (returnvalue.length > 0)
			returnvalue = returnvalue.substring(1,returnvalue.length)

		return 	returnvalue;
	}


		</SCRIPT>
	</BODY>
</HTML>
